package com.atguigu.edu.publisher.mapper;

import com.atguigu.edu.publisher.beans.PlayChapterDate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PlayStatsMapper {

    @Select("SELECT chapter_name , SUM(play_sum) play_sum , SUM(time_sum) time_sum ,SUM(user_sum) user_sum , SUM(time_sum)/SUM(user_sum) avg_rime\n" +
            "from dws_play_chapter_video_window PARTITION par${date} GROUP BY chapter_name order by play_sum DESC LIMIT 20;")
    List<PlayChapterDate> selectChapterDate(@Param("date") String date);
}
